package com.tupu.common;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

/**
 * @author : warden
 * @date : 2023/11/22 9:24
 */
public class BooleanIntConverter implements Converter<Integer> {
    @Override
    public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        if (value == null) {
            return new WriteCellData<>("");
        } else if (value == 1) {
            return new WriteCellData<>("是");
        } else {
            return new WriteCellData<>("否");
        }
    }
}
